<template>
  <div class="topic">
    <ul>
      <li v-for="item in topicArr" :key="item.id">
        <img :src="item.scene_pic_url" width="100%" />
        <h3>{{ item.title }}</h3>
        <div class="van-ellipsis">{{ item.subtitle }}</div>
        <p class="van-ellipsis">{{ item.price_info | filterMoney }}</p>
      </li>
    </ul>
    <van-pagination
      @change="changeFn"
      v-model="page"
      :page-count="totalPages"
      mode="simple"
    />
  </div>
</template>
 
<script>
import { GetTopicDataApi } from "../request/api";
export default {
  data() {
    return {
      topicArr: [],
      page: 1,
      size: "10",
      totalPages: "",
    };
  },
  created() {
    this.changeFn();
  },
  methods: {
    changeFn() {
      GetTopicDataApi({ page: this.page, size: this.size }).then((res) => {
        this.topicArr = res.data.data;
        this.totalPages = res.data.totalPages;
        // console.log(this.totalPages);
      });
    },
  },
};
</script>
 
<style lang = "less">
.topic {
  margin-top: 0px;
  padding-bottom: 40px;
  background-color: #efefef;
  ul {
    li {
      width: 100%;
      text-align: center;
      margin-bottom: 20px;
      background-color: #fff;
      overflow: hidden;
      h3 {
        width: 90%;
        margin: auto;
        line-height: 40px;
        height: 40px;
        font-size: 16px;
      }
      div {
        font-size: 14px;
        line-height: 40px;
        height: 40px;
      }
      p {
        width: 100%;
        font-size: 14px;
        line-height: 40px;
        height: 40px;
        color: darkred;
      }
    }
  }
}

.van-pagination__page-desc {
  display: none;
}
</style>